package com.kly.utils;

import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

import static com.kly.constants.RedisConstant.BLOOM_FILTER_PICTURE_KEY;

/**
 * @author admin
 * @date 2025/4/25
 */
@Component
public class BloomFilter {

    @Resource
    private RedissonClient redissonClient;

    public RBloomFilter<String> getBloomFilter(String key) {
        RBloomFilter<String> bloomFilter = redissonClient.getBloomFilter(BLOOM_FILTER_PICTURE_KEY + key);
        bloomFilter.tryInit(1000000, 0.01);
        return bloomFilter;
    }

}
